package com.appspot.inkisapi.server;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.HandlerExceptionResolver;
import org.springframework.web.servlet.ModelAndView;

public class JsonExceptionResolver implements HandlerExceptionResolver {

	@Override
	public ModelAndView resolveException(HttpServletRequest arg0,
			HttpServletResponse arg1, Object arg2, Exception arg3) {
		ModelAndView mav = new ModelAndView();
		mav.setViewName("MappingJacksonJsonView");
		mav.addObject("error", arg3.getMessage());
		return mav;
	}

}
